/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.zx.Logic;

/**
 *
 * @author VcLi
 */
public class MethodsNotUsed {
    // private ArrayList<String> stnList = new ArrayList<String>();
//            private void selectTsDisplayStn(TrainService ts) {
//        //To remove all the elements left by the previous selection
//        DefaultTableModel tableModel = (DefaultTableModel) tblTrainService.getModel();
//        tableModel.getDataVector().removeAllElements();
//
//        //get the list stored in the trainservice object
//        ArrayList<Station> stnListInTs = ts.getStnList();
//        int counter = 0;
//
//        for (Station stnInList : stnListInTs) {
//            //a little bit formatting of the text here
//            String s = "";
//            int stationNo = counter + 1;
//            if (stationNo < 10) {
//                s = "0" + stationNo;
//            } else {
//                s = "" + stationNo;
//            }
//
//            //set up the data to display on the table
//            String[] rowData = {s, stnInList.getName()};
//            tableModel.insertRow(counter, rowData);
//            counter++;
//        }
//    }
    //    private void retrieveStnMap() {
//        Collection c = stnMap.values();
//        Station stn = null;
//        Iterator itr = c.iterator();
//        int counter = 0;
//        while (itr.hasNext()) {
//
//            stn = (Station) itr.next();
//            if (stn.isInterchange()) {
//                System.out.println(stn.getName());
//                System.out.println("-------------------");
//                ArrayList<TrainService> tempal = stn.getOperatingTsInStn();
//                for (TrainService tstemp : tempal) {
//                    System.out.println(tstemp.getName());
//                }
//                counter++;
//                System.out.println("");
//            }
//
//            //ArrayList<TrainService> tempal = stn.getOperatingTsInStn();
////            System.out.println(stn.getName());
////            System.out.println("++++++++++++++");
////            for (TrainService tstemp : tempal) {
////                System.out.println(tstemp.getName());
////            }
////            System.out.println("----------------------------");
//
//        }
//        System.out.println(counter);
//        //System.out.println(stnMap.size());
//    }
    
//    private void selectStnDisplayTs(Station stn) {
//        //To remove all the elements left by the previous selection
//        DefaultTableModel tableModel = (DefaultTableModel) tblStnInfo.getModel();
//        tableModel.getDataVector().removeAllElements();
//
//        //get the list stored in the trainservice object
//        ArrayList<TrainService> tsOpInList = stn.getOperatingTsInStn();
//        int counter = 0;
//
//        for (TrainService tsInList : tsOpInList) {
//            //a little bit formatting of the text here
//            String s = "";
//            int stationNo = counter + 1;
//            if (stationNo < 10) {
//                s = "0" + stationNo;
//            } else {
//                s = "" + stationNo;
//            }
//
//            //set up the data to display on the table
//            String[] rowData = {s, tsInList.getName()};
//            tableModel.insertRow(counter, rowData);
//            counter++;
//        }
//    }
    //    public static void main(String[] args) {
//        TrainManager tm = new TrainManager();
//        //stnList.add("abc");
//        tm.readFile();
//
//        //tm.testing();
//
//        //tm.testSort();
//
//
//    }
//    private void testSort() {
//        Collections.sort(stnList);
//        for (String ss : stnList) {
//            System.out.println(ss);
//        }
//
//    }
//    private void genStnMap() {
//        //Retrive the name of station from stnList
//        //Algorithm: Loop through the Train Service HashMap, when it finds the station
//        //in a Service, add this service into the station HashMap.
//
//        Collection c = null;
//        Iterator itr = null;
//        ArrayList<Station> stnListInTS = null;
//        ArrayList<TrainService> tsForAStation = new ArrayList<TrainService>();
//        //sort the list in nature order(A-Z)
//        Collections.sort(stnList);
//        //loop through the namelist of stations(no duplication)
//        for (String stnName : stnList) {
//            c = trainServiceMap.values();
//            itr = c.iterator();
//            //loop through all the trainService
//            while (itr.hasNext()) {
//                ts = (TrainService) itr.next();
//                stnListInTS = ts.getStnList();
//                //loop through the stnList in a trainSerivce
//                for(Station stnNameInTs : stnListInTS ){
//                    //if matched, it means the station is in this TrainService
//                   if(stnNameInTs.getName().equals(stnName)){
//                       //add this trainService into a list
//                       tsForAStation.add(ts);
//                       //System.out.println(ts.getServiceName());
//                   }
//                }
//            }
//            //System.out.println("----------------");
//            //create a station object to store the information
//            //The ArrayList for trainService contains full information
//            //put all the station object into the stnMap
//            stn = new Station();
//            stn.setName(stnName);
//            stn.setOperatingTsInStn(tsForAStation);
//            stnMap.put(stnName, stn);
//               
//        }
//    }
//    
//    //To filter all the duplicated station names
//    private void genPureStnList(String dataLine) {
//
//        isDuplicated = false;
//        for (String s : stnList) {
//            //trim the string to remove the duplication
//            if (s.trim().equalsIgnoreCase(dataLine.trim())) {
//                isDuplicated = true;
//            }
//        }
//        if (!isDuplicated) {
//            stnList.add(dataLine);
//        }
//    }
}
